<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <input type="text">
</body>
<script>
  //节流 减少事件触发的频率
  let flag = true
  document.querySelector('input').oninput = function () {
    if (flag) {
      console.log(this.value);
      flag = false

      setTimeout(() => {
        flag = true
      }, 1000)
    }
  }
</script>

</html>